const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig({
  // transpileDependencies: true,
  transpileDependencies: [ //编译node_modules es6=>es5
    /[/\\]node_modules[/\\](.+?)?mapbox(.*)/,
    /[/\\]node_modules[/\\](.+?)?element-ui(.*)[/\\]src/,
    /[/\\]node_modules[/\\](.+?)?element-ui(.*)[/\\]package/,
    /[/\\]node_modules[/\\](.+?)?f-render(.*)/,
    /[/\\]node_modules[/\\](.+?)?quill-image-drop-module(.*)/,
    /[/\\]node_modules[/\\](.+?)?vue-ele-form(.*)/,
    /[/\\]node_modules[/\\](.+?)?vue-ele-form-bmap(.*)/,
    /[/\\]node_modules[/\\](.+?)?vue-baidu-map(.*)/,
    /[/\\]node_modules[/\\](.+?)?vue-ele-upload-image(.*)/,
  ],
  publicPath: process.env.VUE_APP_PUBLIC_PATH, //process.env.VUE_APP_MODE === 'production' ? '/fourCard/' :'/',
  lintOnSave: false, //关闭eslint
  productionSourceMap: false, // 生产环境是否生成 sourceMap 文件
  devServer: { //开发环境代理
    historyApiFallback: true,
    proxy: {
      '/napi': { //注意：此处不可使用 / 
        target: process.env.VUE_APP_BASE_API, // "http://8.142.41.23:8888",
        changOrigin: true,
        ws: false,
        logLevel: 'debug', //代理日志输出 ~暂不生效
        pathRewrite: {
          '^/napi': process.env.VUE_APP_API_BASE_URL // '^api': ''
        }
      },
    },
  },
  css: {
    loaderOptions: {
      sass: {
        data: '@import "@/assets/scss/base.module.scss";' //需要在.scss前面加.module,否则在vue的单文件中，获取到的全局变量为空对象
      }
    }
  }
})
